package com.example.test8326;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

/**
 * SharedPreferences用法 测试Activity
 *
 * @author Gavin
 */
public class MainActivity extends Activity {

    Button button1, button2, button3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        button1 = (Button) findViewById(R.id.button1);
        button2 = (Button) findViewById(R.id.button2);
        button3 = (Button) findViewById(R.id.button3);
        button1.setOnClickListener(new ButtonListener());
        button2.setOnClickListener(new ButtonListener());
        button3.setOnClickListener(new ButtonListener());
    }

    private class ButtonListener implements View.OnClickListener {
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.button1:
                    Intent intent1 = new Intent(MainActivity.this, Sharedpreferences.class);
                    startActivity(intent1);
                    break;
                case R.id.button2:
                    Intent intent2 = new Intent(MainActivity.this, rwfile.class);
                    startActivity(intent2);
                    break;
                case R.id.button3:
                    Intent intent3 = new Intent(MainActivity.this, SQLiteActivity.class);
                    startActivity(intent3);
                    break;
            }
        }
    }
}